home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 1 / Meeting Pearls Vol 1 (1994).iso / installed_progs / gfx / lise2.1 / lise / src / liseset.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-31  |  619 b   |  36 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. breakchar(c)
  5. char c;
  6. {
  7.    if(c == ' ') return(-1);
  8.    if(c == ',') return(-1);
  9.    if(c == '=') return(-1);
  10.    if(c == 0) return(-1);
  11.    return(0);
  12. }
  13.  
  14.  
  15. main(argc,argv)
  16. int argc;
  17. char **argv;
  18. {
  19. int i,n;
  20. char name[80],s[80],z[80],t[80];
  21. FILE *fp;
  22.  
  23.    strcpy(s,"");
  24.    for(i = 1; i < argc; i++) {strcat(s,argv[i]); strcat(s," ");}
  25.    i = 0;
  26.    while(!breakchar(s[i])) {name[i] = s[i]; i++;}
  27.    name[i++] = 0;
  28.    n = 0;
  29.    while(s[i] != 0) z[n++] = s[i++];
  30.    z[n] = 0;
  31.    setenv(name,z);
  32.    sprintf(t,"env:%s",name);
  33.    fp=fopen(t,"w"); fprintf(fp,"%s",z); fclose(fp);
  34.    exit(0);
  35. }
  36.